<?php

namespace api\tests;

use api\tests\FunctionalTester;

class DiaryUpdateCest
{
	public function _before(FunctionalTester $I)
	{
	}

	public function _after(FunctionalTester $I)
	{
	}

	// tests
	public function tryToTestDiaryUpdate(FunctionalTester $I)
	{
		$form = [
				'title' => '这是一个测试用例',
				'content' => '测试数据能不能修改成功',
				'addOn'=>[
					'id'=>415,
					'ob_addr'=>'北京',
					'ob_object'=>'123',
					'description'=>'床前明月光,疑是地上霜,举头望明月,低头思故乡',
					'future'=>'李白,字太白,唐朝人',
				],
		];
		$I->sendPUT('/v1/diaries/415', $form);
		$I->seeResponseCodeIs(200);
		$data = $I->grabResponse();
		$data = json_decode($data);
		$I->seeResponseContainsJson(['future'=>'李白,字太白,唐朝人']);
		expect($data->id)->equals($form['addOn']['id']);
	}
}
